/*
*	File: Vector.h
*	Date: 12/05/2011
*	Author: Ivan Gao
*	Desc: Vector class.
*/
#ifndef VECTOR_H_
#define VECTOR_H_
#include <cmath>
#include "commondef.h"
using namespace std;
class SIMPLEANIMATION_API SVector3
{
public:
	union
	{
		struct
		{
			float x, y, z;
		};
		struct  
		{
			float v[3];
		};
	};
public:
	SVector3 (void);
	SVector3 (float _x, float _y, float _z);
	SVector3 (const SVector3 & crVector);
	~SVector3 ();
	SVector3 & operator = (const SVector3 & crVector);
	SVector3 & operator += (const SVector3 & crVector);
	SVector3 & operator -= (const SVector3 & crVector);
	SVector3 & operator *= (float scale);
	SVector3 & operator /= (float scale);
	SVector3 & operator - (void);
	inline float operator [] (int nIdx);
	inline float operator [] (int nIdx) const;
	float GetLength (void) const;
	SVector3 & Normalize (void);
	float DotProduct (const SVector3 & rcVector);
	SVector3 & CrossProduct (const SVector3 & rcVector);
	bool operator == (const SVector3 & rcVector);
	bool operator != (const SVector3 & rcVector);
	void SetValue (float _x, float _y, float _z);
};
SVector3 SIMPLEANIMATION_API operator + (const SVector3 & rFrist, const SVector3 &rSecond);
SVector3 SIMPLEANIMATION_API operator - (const SVector3 & rFirst, const SVector3 &rSecond);
SVector3 SIMPLEANIMATION_API operator * (const SVector3 & rVector, float scale);
SVector3 SIMPLEANIMATION_API operator / (const SVector3 & rVector, float scale);
SVector3 SIMPLEANIMATION_API operator - (const SVector3 & rVector);
float SIMPLEANIMATION_API DotProduct (const SVector3 & rFirst, const SVector3 & rSecond);
SVector3 SIMPLEANIMATION_API CrossProduct (const SVector3 & rFirst, const SVector3 & rSecond);
SVector3 SIMPLEANIMATION_API Normalize (const SVector3 & rcVector);
bool SIMPLEANIMATION_API operator == (const SVector3 & rFrist, const SVector3 & rSecond);
bool SIMPLEANIMATION_API operator  != (const SVector3 & rFirst, const SVector3 & rSecond);

#endif // VECTOR_H_